﻿//-----------------------------------------------------------------------
// <copyright file="PivotTableCategoryForm.cs" company="Forebrain Technology, LLC">
//
// Copyright (c) Forebrain Technology, LLC. All rights reserved.
// 
// This source code is released under the Microsoft Public License (Ms-PL).
//
// </copyright>
//-----------------------------------------------------------------------
namespace PivotCollectionMaker.WinFormApplication
{
    using System.Windows.Forms;
    using PivotCollectionTools.Data;

    /// <summary>
    /// Category form.
    /// </summary>
    public partial class PivotTableCategoryForm : Form
    {
        /// <summary>
        /// Storage for the model
        /// </summary>
        private PivotTableCategory model;

        /// <summary>
        /// Initializes a new instance of the <see cref="PivotTableCategoryForm"/> class.
        /// </summary>
        public PivotTableCategoryForm()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Gets or sets the model.
        /// </summary>
        /// <value>The model of the pivot table category form.</value>
        public PivotTableCategory Model 
        {
            get
            {
                return this.model;
            }

            set
            {
                this.model = value;
                this.BindData();
            }
        }

        /// <summary>
        /// Binds the data.
        /// </summary>
        private void BindData()
        {
            this.uxCategoryBindingSource.SuspendBinding();
            this.uxCategoryBindingSource.DataSource = this.model;
            this.uxCategoryBindingSource.ResumeBinding();
        }
    }
}
